app
.controller('formSelfCtrl', ['$scope', '$http', FormSelfController]);
function FormSelfController($scope, $http){
	$scope.changeValueMap = function(field) {
		var soseBase = parseFloat($scope.valueMap['soseBase']); // 社保基数
		var piRatioUnit = parseFloat($scope.valueMap['piRatioUnit']); // 养老保险比例（单位）
		var piRatioIndividual = parseFloat($scope.valueMap['piRatioIndividual']); // 养老保险比例（个人）
		var uiRatioUnit = parseFloat($scope.valueMap['uiRatioUnit']); // 失业保险比例（单位）
		var uiRatioIndividual = parseFloat($scope.valueMap['uiRatioIndividual']); // 失业保险比例（个人）
		if( (soseBase || soseBase==0 )
			&&  (piRatioUnit || piRatioUnit==0 )
			&&   (piRatioIndividual || piRatioIndividual==0 )
			&&   (uiRatioUnit || uiRatioUnit==0 )
			&& (uiRatioIndividual || uiRatioIndividual==0 )
			) {
			// 养老保险（单位）/月
			var piUnitMonth = (soseBase * (piRatioUnit/100)).toFixed(2);
			$scope.valueMap['piUnitMonth'] = piUnitMonth;
			// 养老保险（个人）/月
			var piIndividualMonth = (soseBase * (piRatioIndividual/100)).toFixed(2);
			$scope.valueMap['piIndividualMonth'] = piIndividualMonth;
			// 失业保险（单位）/月
			var uiUnitMonth = (soseBase*(uiRatioUnit/100)).toFixed(2);
			$scope.valueMap['uiUnitMonth'] = uiUnitMonth;
			// 失业保险（个人）/月
			var uiIndividualMonth = (soseBase*(uiRatioIndividual/100)).toFixed(2) ;
			$scope.valueMap['uiIndividualMonth'] = uiIndividualMonth;

		}
	}
}

